﻿@model sBlog.Net.Areas.Admin.Models.PostViewModel

@Html.Partial("UpdatePostOrPageStatus", Model)

@using (Html.BeginForm())
{
    <div id="maincontent">
        <div id="left" style="float: left; width: 75%; padding: 15px;">
            @Html.HiddenFor(model => model.Post.PostID)
            @Html.HiddenFor(model => model.Post.PostAddedDate)

            @{
                var display = "Post";
                if (Model.Post.EntryType == 2)
                {
                    display = "Page";
                }
            }

            <b>@display.ToLower() title</b><br /><br />
            @Html.TextBoxFor(model => model.Post.PostTitle, new { @class = "inputBoxBigPost postTitle" })
            <br /><br />
            <div style="float: left; width: 60%;"> 
                <b>
                     @display.ToLower() content
                </b>
            </div>
            <div style="float: left;">
                <img src="@Url.Content("~/Content/Images/new_window_icon.png")" alt="" title="full screen" style="border:0px; width: 12px; height: 12px" />  <a title="open the editor in full screen" id="fullScreen" href="javascript:void(0)"><span style="text-decoration: underline">full screen</span></a> |
                <img src="@Url.Content("~/Content/Images/preview.png")" alt="" title="preview" style="border:0px; width: 12px; height: 12px" />  <a title="click for a preview" id="contentPreview" href="javascript:void(0)"><span style="text-decoration: underline">preview</span></a> |
                @Html.Action("SyntaxHighlighterHelp", "Admin")
            </div>
            <br /><br />
            @Html.TextAreaFor(model => model.Post.PostContent, new { @class = "adminRichText" })
            <br />
            <b>post url</b>
            <br /><br />
            <h4 class="postUrlLabel" title="click to edit the url">---</h4>
            <span class="postUrlPrefix"></span>@Html.TextBoxFor(model => model.Post.PostUrl, new { @class = "postUrl" })
            @Html.HiddenFor(model => model.Post.PostUrl, new { @class = "postUrlValue" })
            <span class="urlControls">
                <input type="button" id="btnUpdate" value="ok" />&nbsp;<input type="button" id="btnCancel" value="cancel" />
            </span>
            <br /><br />
        </div>

        <div id="right" style="float: left;">
            <div class="cpHeader">
                <b>Publish Options</b>
            </div>
            <div class="cpContent">
                @Html.CheckBoxFor(model => model.Post.IsPrivate, new { @class = "privateChkBox" })
                @Html.LabelFor(model => model.Post.IsPrivate)
                <br /><br />
                <input type="submit" value="Publish" class="publishBtn" />  
                
                <span>&nbsp;</span>
                
                @if (Model.Post.EntryType == 1)
                {
                    @Html.ActionLink("delete post", "DeletePost", "Post", new {postID = Model.Post.PostID}, new { @class = "edit-trash" });
                }
                else
                {
                    @Html.ActionLink("delete page", "DeletePage", "Page", new { postID = Model.Post.PostID }, new { @class = "edit-trash" });
                }
            </div>
            <br /><br />
            <div class="cpHeader">
                <b>@display Options</b>
            </div>
            <div class="cpContent">
                @Html.CheckBoxFor(model => model.Post.UserCanAddComments)
                @Html.LabelFor(model => model.Post.UserCanAddComments)
                <br /><br />
                @{
                var cssStyle = Model.SharingEnabled ? "" : "sharing-disabled";
                var title = Model.SharingEnabled ? "" : "Sharing is disabled for this blog. Your setting is overriden by the blog's setting.";
                }
                <span title="@title" class="@cssStyle">
                    @Html.CheckBoxFor(model => model.Post.CanBeShared)
                    @Html.LabelFor(model => model.Post.CanBeShared)
                </span>
            </div>
            <br /><br />
            @if (Model.Post.EntryType == 1)
            {
                <div class="cpHeader">
                    <b>Categories</b>
                </div>
                <div class="cpContent">
                    @Html.Partial("Categories", Model.Categories)
                </div>
            }
            
            @if (Model.Post.EntryType == 2)
            {
                
                <div class="cpHeader">
                    <b>Page Order</b>
                </div>
                <div class="cpContent">
                    @Html.TextBoxFor(model => model.Post.Order, new { @class = "inputBoxBigOrder" })
                </div>
            }

            @Html.HiddenFor(model => model.Post.EntryType)
            
            @if (Model.Post.EntryType == 1)
            {
                <br />
                <div class="cpHeader">
                    <b>Tags</b>
                </div>
                <div class="cpContent">
                    @Html.Partial("Tags", Model.Tags)
                </div>
            }
        </div>
    </div>
}
